﻿@model Promocot.Models.Recurso

@{
    ViewBag.Title = "uprecurso";
}

<script type="text/javascript">
    $(function () {

        $("#tipo").change(function () {

            if ($("#tipo").val() == 3) {
                $("#direccion").fadeOut();
                $('#video_special').append('<textarea type="text" name="direccion" class="vid_direccion"></textarea>');
            } else {
                $(".vid_direccion").fadeOut();
                $("#direccion").fadeIn();
            }
        })
    });

</script>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm("uprecurso", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Recurso</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.cod_empresa)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.cod_empresa, new SelectList(ViewBag.empresas, "cod_empresa", "nombre_empresa"))
            @Html.ValidationMessageFor(model => model.cod_empresa)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.cod_clasificacion)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.cod_clasificacion, new SelectList(ViewBag.clasificaciones, "cod_clasificacion", "nombre"))
            @Html.ValidationMessageFor(model => model.cod_clasificacion)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.nombre)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.nombre)
            @Html.ValidationMessageFor(model => model.nombre)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.direccion)
        </div>
        <div class="editor-field">

         <div class="editor-field" id="video_special">

            <input class="text-box single-line" id="direccion" name="direccion" type="file"/>

            <span class="field-validation-valid" data-valmsg-for="direccion" data-valmsg-replace="true"></span>

        </div>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.tipo)
        </div>
        <div class="editor-field">
        @{
       List<SelectListItem> items = new List<SelectListItem>();
       items.Add(new SelectListItem
       {
           Text = "Archivo",
           Value = "1"
       });
       items.Add(new SelectListItem
       {
           Text = "Imagen",
           Value = "2",
           Selected = true
       });
       items.Add(new SelectListItem
       {
           Text = "Video",
           Value = "3"
       });
            
            }
            @Html.DropDownListFor(model => model.tipo, items)
            @Html.ValidationMessageFor(model => model.tipo)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.solo_usado_en_tipo)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.solo_usado_en_tipo)
            @Html.ValidationMessageFor(model => model.solo_usado_en_tipo)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.solo_usado_en_cod)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.solo_usado_en_cod)
            @Html.ValidationMessageFor(model => model.solo_usado_en_cod)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

